import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useAuthStore = defineStore('auth', () => {
  const token = ref(localStorage.getItem('token') || '')

  function login(mockToken) {
    token.value = mockToken
    localStorage.setItem('token', mockToken)
  }

  function logout() {
    token.value = ''
    localStorage.removeItem('token')
  }

  return { token, login, logout }
})
